package com.wandafilm.app.jetpack.frame.ui

import android.os.Bundle
import com.alibaba.android.arouter.facade.annotation.Route
import com.kotlin.android.core.BaseActivity
import com.kotlin.android.router.factory.ProviderFactory
import com.kotlin.android.router.path.RouterActivityPath
import com.kotlin.android.router.path.RouterProviderPath
import com.kotlin.android.router.provider.main.IMainProvider
import com.wandafilm.app.R

@Route(path = RouterActivityPath.Main.PAGER_SPLASH)
class SplashActivity : BaseActivity() {
    private val timeOut: Long = 1 * 1000
    private val createProvider = ProviderFactory
        .getInstance<IMainProvider>(RouterProviderPath.Provider.PROVIDER_MAIN)

    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        setContentView(R.layout.activity_splash)
        window.decorView.postDelayed({
            createProvider?.startMain()
            finish()
        }, timeOut)
    }
    /*companion object {
        val mHandler = Handler()
    }

    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        setContentView(R.layout.activity_splash)
        splashIv.let {
            mHandler.postDelayed({
                startActivity(
                    Intent(this@SplashActivity, MainActivity::class.java)
                )
                finish()
            }, 500)
        }
    }
    override fun onDestroy() {
        super.onDestroy()
        mHandler.removeMessages(0)
    }*/
}
